<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	var comboData = {
		equipmentTypeBZCombo:null,
	}
	
	$(function() {

		$('#form').form({
			url : '/deviceType/edit',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.openner_typeGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为resource.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				}else{
					parent.$.messager.alert('提示',result.msg,'info');
				}
			}
		});
		parent.$.messager.progress('close');
		//getTypeBzCode();
	});
	
	//得到设备类型唯一标识值下拉选项
	function getTypeBzCode(){
		$.ajax({
			type:'post',
			url:'/deviceCommController/getDevTypeBZComboData',
			data:{},
			success:function(result) {
				comboData.equipmentTypeBZCombo = result.equipmentTypeBZCombo;
				$('#equipmentTypeCode').combobox({
					data : comboData.equipmentTypeBZCombo,
					valueField:'value',   
				    textField:'text',
				    panelHeight:'auto',
					onLoadSuccess: function(){
						$('#equipmentTypeCode').combobox('setValue','${deviceType.equipmentTypeCode}');
					}
				});
			},
			dataType:'json'
		});
	}
	
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post">
			<input type="hidden" name="id" value="${deviceType.id }"/>
			<input type="hidden" name="isDel" value="${deviceType.isDel }" />
			<table class="table table-hover table-condensed">
				<tr>
					<th>设备类型名称</th>
					<td><input id="iconCls" class="easyui-validatebox" value="${deviceType.name}" name="name" style="width: 375px; height: 29px;" data-options="editable:false,required:true" /></td>
				</tr>
				<tr>
					<th>类型唯一标识</th>
					<td ><input name="equipmentTypeCode" id="equipmentTypeCode" type="text"  ></td>
				</tr>
				<tr>
					<th>备注</th>
					<td><textarea name="remark" rows="" cols="" class="span5">${deviceType.remark}</textarea></td>
				</tr>
			</table>
		</form>
	</div>
</div>